<template>
  <div class='notify-detail'
       v-if='notifyData'>
    <div class='title-h4'>
      {{notifyData.notifyTitle}}

    </div>
    <div>
      {{notifyData.notifyContent}}
    </div>
    <div class='time'> <span> {{notifyData.beginDateStr}}</span></div>
  </div>
</template>


<script>

import { LiteappNotify } from '@/api/api'

export default {
  data () {

  },

  computed: {
    notifyData () {
      console.log(this.$store)

      return this.$store.state.notify_item
    }
  },
  onShow () {
    this.getLiteappNotify()
  },
  methods: {

    async  getLiteappNotify () {
      let notifyData = await LiteappNotify()
      let currentYear = new Date().getFullYear()
      console.log(currentYear)

      for (let key of notifyData) {
        let year = key.beginDateStr.slice(0, key.beginDateStr.indexOf('-'))
        if (Number(year) === currentYear) {
          key.beginDateStr = key.beginDateStr.slice(key.beginDateStr.indexOf('-') + 1)
        }
      }
      this.notifyData = notifyData
    }

  }

}
</script>

<style scoped lang="scss">
@import '@/common/scss/base.scss';
.notify-detail {
  position: absolute;
  top: 0;
  left: 0;
  background: #fff;
  padding: 0 30px;
  width: 100%;
  min-height: 100%;
  box-sizing: border-box;
  > div {
    @include fontSize(28);
    @include color666;
  }
  > .title-h4 {
    height: 88px;
    @include fontSize(32);
    @include fjc(center);
    font-weight: 700;
    color: $croci;
    position: relative;
  }
  .time {
    display: flex;
    justify-content: flex-end;
    span {
      @include fontSize(28);
      height: 100%;
      @include fjc(center);
    }
  }
}
</style>
